package demo5;

class Animals {
    public void say() {

    }
}
class Dog extends Animals {
    public void say() {
        System.out.println("狗");
        System.out.println("会跑");
    }
}
class Duck extends Animals {
    public void say() {
        System.out.println("鸭子");
        System.out.println("会游泳");
    }
}
class Bird extends Animals{
    public void say() {
        System.out.println("鸟");
        System.out.println("会飞");
    }
}
public class Text {
    public static void print(Animals animals) {
        animals.say();
    }
    public static void main(String[] args) {//多态
        print(new Dog());
        print(new Bird());
        print(new Duck());
    }
}
